package com.sailfish.template.infra.exception;

/**
 * @author XIAXINYU3
 * @date 2020/9/2
 */
public enum ExceptionType {
    DB_BAD_SQL_GRAMMAR("服务器异常：syntax", 1101),

    REQUEST_SERVER_ERROR("请求服务异常", 7101),
    REQUEST_PARAM_ERROR("请求参数异常", 8101),
    REQUEST_PARAM_MISSING("缺少请求参数", 8102),
    REQUEST_METHOD_NOT_SUPPORTED("请求方法不支持", 8103),
    SYS_NULL_POINT("服务器异常：null", 9101),
    SYS_BUSINESS_ERROR("服务器异常：unknown", 1001);

    private String message;
    private Integer code;

    ExceptionType(String message, Integer code) {
        this.message = message;
        this.code = code;
    }

    public String getErrorMessage() {
        return String.format("%s - %d", this.message, this.code);
    }
}
